<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>管理员登录</title>
</head>
<script type="text/javascript" src="js/jquery-easyui-1.4.1/jquery.min.js"></script>
<body style="background-color: #F3F3F3">
<div class="easyui-dialog" title="管理员登录" data-options="closable:false,draggable:false" style="width:400px;height:300px;padding:10px;margin:50px auto">
	<div style="margin-left: 50px;margin-top: 50px;">
		<h1>请管理员登录使用</h1>
		<div style="margin-bottom:20px;">
			<div id="account">
				账号: <input name="account" class="easyui-textbox"  data-options="required:true" style="width:200px;height:32px"/>

				<div class="tip"></div>
			</div>
		</div>
		<div style="margin-bottom:20px">
			<div>
				密码: <input name="password" class="easyui-textbox" type="password" style="width:200px;height:32px" data-options="" />
			</div>
		</div>
		<div>
			<a id="login" class="easyui-linkbutton" iconCls="icon-ok" >登录</a>
		</div>
	</div>
</div>
<style type="text/css">
	#login{
		width:100px;
		height:32px;
		margin-left:100px
	}
	#login:hover{
		cursor: pointer;
		color:red;
	}
	#account{
		position: relative;
	}
	#account .tip{
		position: absolute;

		height:30px;
		font-size: 14px;
		top:0;
		right:-100px;
		vertical-align: middle;
		line-height: 30px;
	}
</style>
<script type="text/javascript">
	$("#login").click(function(){
		var account = $("[name=account]").val();
		var password = $("[name=password]").val();
		if(account.trim() != "" && password.trim() != ""){
			$.ajax({
				"type":"post",
				"url":"/admin/login",
				"data":{"account":account,"password":password},
				"success":function(result){
					if(result.status == 200){
						window.location.href="/index";
					} else {
						var errorMessage = result.msg;
						$("#account .tip").html(errorMessage);
					}

				},
				"error":function(data){
					$("#account .tip").html("貌似服务器出错了");
				}
			})
		} else {
			$("#account .tip").html("请输入用户名或密码");
		}



	});
</script>
</body>
</html>